#ifndef USERSERVICE_H
#define USERSERVICE_H

#include <QString>
#include <regex>
#include "dal/dao/UserDataAccess.h"
#include "dal/persistence/FileConnector.h"
#include "entity/UserInfo.h"

using namespace std;

// 用户业务类
class UserService
{
public:
    bool isValidEmail(const string &str);
    bool isValidPhone(const string &str);

    int userLogin(QString loginInfo, QString password);
    int userRegister(QString registerInfo, QString password);
    bool addUserImage(int userId, const QByteArray &imageData);
    QByteArray getUserImage(int userId);

    bool changeUserPassword(const QString &userId, const QString &newPassword);
    bool deleteAccount(QString userId);

    UserInfo getUserInfo(const int userID);
    bool updateUserInfo(const int &userId, const QString &nickname, const QString &sex, const QString &email, const QString &sign);
};

#endif // USERSERVICE_H
